package com.minshenglife.zanzan.service.power.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.minshenglife.zanzan.dao.power.MUserPowerDao;
import com.minshenglife.zanzan.entity.power.MUserPower;
import com.minshenglife.zanzan.service.power.MUserPowerService;

@Service
@Transactional
public class MUserPowerServiceImpl implements MUserPowerService {

	@Autowired
	MUserPowerDao mUserPowerDao;
	
	@Override
	public List<MUserPower> getMUserPowers(MUserPower user) {
		List<MUserPower> list = null;
		try{
			list = mUserPowerDao.findByExample(user);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return list;
	}

	@Override
	public boolean updateMUserPower(MUserPower user) {
		try{
			mUserPowerDao.update(user);
		}catch(Exception ex){
			ex.printStackTrace();
			return false;
		}
		return true;

	}

	@Override
	public boolean deleteMUserPower(MUserPower user) {
		try{
			mUserPowerDao.deleteByExample(user);
		}catch(Exception ex){
			ex.printStackTrace();
			return false;
		}
		return true;
		
	}

	@Override
	public boolean addMUserPower(MUserPower user) {
		try{
			mUserPowerDao.add(user);
		}catch(Exception ex){
			ex.printStackTrace();
			return false;
		}
		return true;
	}

}
